import 'package:json_annotation/json_annotation.dart';

part 'v_key_parse.g.dart';

@JsonSerializable()
class VKeyParse extends Object {
  @JsonKey(name: 'code')
  int code;

  @JsonKey(name: 'cid')
  int cid;

  @JsonKey(name: 'userip')
  String userip;

  @JsonKey(name: 'data')
  Data data;

  VKeyParse(
    this.code,
    this.cid,
    this.userip,
    this.data,
  );

  factory VKeyParse.fromJson(Map<String, dynamic> srcJson) => _$VKeyParseFromJson(srcJson);

  Map<String, dynamic> toJson() => _$VKeyParseToJson(this);
}

@JsonSerializable()
class Data extends Object {
  @JsonKey(name: 'expiration')
  int expiration;

  @JsonKey(name: 'items')
  List<Items> items;

  Data(
    this.expiration,
    this.items,
  );

  factory Data.fromJson(Map<String, dynamic> srcJson) => _$DataFromJson(srcJson);

  Map<String, dynamic> toJson() => _$DataToJson(this);
}

@JsonSerializable()
class Items extends Object {
  @JsonKey(name: 'subcode')
  int subcode;

  @JsonKey(name: 'songmid')
  String songmid;

  @JsonKey(name: 'filename')
  String filename;

  @JsonKey(name: 'vkey')
  String vkey;

  Items(
    this.subcode,
    this.songmid,
    this.filename,
    this.vkey,
  );

  factory Items.fromJson(Map<String, dynamic> srcJson) => _$ItemsFromJson(srcJson);

  Map<String, dynamic> toJson() => _$ItemsToJson(this);
}
